/*
package com.tt.mymu.utils;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;


import java.util.Map;
import java.util.Set;

@Component
@Slf4j
public class JedisUtil {

    @Autowired
    private JedisPool jedisPool;

    */
/**
     * 存入redis缓存
     *
     * @param key
     * @param value
     *//*

    public void set(String key, String value) {
        Jedis jedis = null;
        try {
            jedis = jedisPool.getResource();
            jedis.set(key, value);
        } catch (Exception ex) {
            log.error("存储redis出错" + ex);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }

    }

    */
/**
     * 从redis缓存中读取
     *//*

    public String get(String key) {
        Jedis jedis = null;
        try {
            jedis = jedisPool.getResource();
            return jedis.get(key);
        } catch (Exception ex) {
            log.error("读取redis出错" + ex);
            return StringUtils.EMPTY;
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }

    }

    */
/**
     * 从redis缓存中移除
     *//*

    public void remove(String key) {

        Jedis jedis = null;
        try {
            jedis = jedisPool.getResource();
            jedis.del(key);
        } catch (Exception ex) {
            log.error("移除redis出错" + ex);

        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }

    */
/**
     * 从redis缓存中移除指定前缀的所有值
     *//*

    public void removePrefix(String prefix) {

        Jedis jedis = null;
        try {
            jedis = jedisPool.getResource();
            Set<String> set= jedis.keys(prefix+"*");
            for (String item: set) {
                jedis.del(item);
            }

        } catch (Exception ex) {
            log.error("移除redis出错" + ex);

        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }

    }

    */
/**
     * 批量存入缓存
     * @param cachedMap
     *//*

    public void setBatch(Map<String,String> cachedMap) {
        Jedis jedis = null;
        try {
            jedis = jedisPool.getResource();
            for(String key : cachedMap.keySet()) {
                jedis.set(key, cachedMap.get(key));
            }
        } catch (Exception ex) {
            log.error("存储redis出错" + ex);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }

}
*/
